<?php
	require '../config.php';
	require '../inc/require.php';	
	
	//enable_errors();
	
	$chip_id_sender = Session::get('chip_id');
	$chip_id = $_POST['chip_id'];
	$outgoing_message = $_POST['message'];
	
	$message = new Message();
	$message->chip_id = $chip_id;
	$message->message = $outgoing_message;
	$message->chip_id_sender = $chip_id_sender;
	$message->time = date("H:i");
	if($chip_id == 0) {
		$message->group = 1;
	} else {
		$message->group = 0;
	}
	$message->save();	
	

	echo 'succesvol aangemaakt';
